package kr.co.boogui.dao;

import java.util.List;

import kr.co.boogui.model.JoinReservationVO;
import kr.co.boogui.model.MovieVO;
import kr.co.boogui.model.ParamVO;
import mybatis3.helper.MVCSqlSessionFactory;

import org.apache.ibatis.session.SqlSession;

public class ReservationDAO {
	public static List<MovieVO> readReservationInfo(String chartmn,String mno) {
		List<MovieVO> result = null;
		SqlSession sess = null;
		ParamVO pvo = new ParamVO();
		pvo.setChartmn(chartmn);
		pvo.setMno(mno);
		try {
			sess = MVCSqlSessionFactory.openSession();
			result = sess.selectList("ReservationMapper.ReservationInfoSQL", pvo);			
		} finally {
			sess.close();
		}
		return result;
	}
	
	public static JoinReservationVO readReservationdetailInfo(String rno,String mno) {
		ParamVO rvo = new ParamVO();
		SqlSession sess = null;
		JoinReservationVO result = null;
		rvo.setRno(rno);
		try {
			sess = MVCSqlSessionFactory.openSession();
			result = sess.selectOne("ReservationMapper.ReservationdetailInfoSQL", rvo);			
		} finally {
			sess.close();
		}
		return result;
	}
	
	public static List<MovieVO> readReservationdetail(String chartmn,String mno) {
		List<MovieVO> result = null;
		SqlSession sess = null;
		ParamVO pvo = new ParamVO();
		pvo.setChartmn(chartmn);
		pvo.setMno(mno);
		try {
			sess = MVCSqlSessionFactory.openSession();
			result = sess.selectList("ReservationMapper.ReservationdetailSQL", pvo);			
		} finally {
			sess.close();
		}
		return result;
	}
}
